/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package besteninilkprojesi;

/**
 *
 * @author ASUS
 */
public class Point3D {
   
    private float x;
    private float y;
    private float z;

    public Point3D(float x, float y, float z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }
    
    public float getZ() {
        return z;
    }

    public void setZ(float z) {
        this.z = z;
    }
    
    public float distance(Point3D point3D){
        float distance_x = (point3D.getX() - getX());
        float distance_y = (point3D.getY() - getY());
        float distance_z = (point3D.getZ() - getZ());
        float p = 0.333333333f;
        float distance_total = (float)Math.pow(((distance_x*distance_x)+(distance_y*distance_y)+(distance_z*distance_z)), p);
        return distance_total;
    }
    
    public static void main(String[] args) {
        Point3D firstPoint = new Point3D(2, 3, 5);
        Point3D secondPoint = new Point3D(5, 6, 8);
        System.out.println("Distance from first point to second point is " + firstPoint.distance(secondPoint));
    }
}
    

